package com.zj.base.httpclien;

import android.content.Context;
import android.text.TextUtils;

import java.util.Map;

/**
 * Created by zhaojie on 2018/3/27.
 */

@SuppressWarnings("unused")
public class HttpConfig {

    private static HttpDataSet mDataSet;
    public static String logTag = "HttpClient --- :";
    private static Context applicationContext;

    public static void init(Context context, String tag, HttpDataSet dataSet) {
        if (!TextUtils.isEmpty(logTag)) logTag = tag;
        applicationContext = context;
        if (dataSet != null) mDataSet = dataSet;
    }

    public static HttpDataSet getDataSet() {
        if (mDataSet == null)
            throw new NullPointerException("HttpConfig ：you can`t use a null content to set http data,or you need call HttpCofig.init() on your Application init");
        else {
            return mDataSet;
        }
    }

    public static Context getApplicationContext() {
        if (applicationContext == null)
            throw new NullPointerException("HttpConfig ：null Context exception ,do you call HttpConfig.init() in your Application?");
        return applicationContext;
    }

    /**
     * witch you want get some config in your application
     */
    public interface HttpDataSet {
        Map<String, String> getCookie();
    }

}
